import type { UserStateVO } from './model';

import type { ID, IDS, PageQuery } from '#/api/common';

import { requestClient } from '#/api/request';

enum Api {
  root = '/system/user/state',
  userStateList = '/system/user/state/list',
  userStateSelect = '/system/user/state/optionselect',
}

/**
 * 获取用户状态列表
 * @param params 参数
 * @returns UserStateVO[]
 */
export function userStateList(params?: PageQuery) {
  return requestClient.get<UserStateVO[]>(Api.userStateList, { params });
}

/**
 * 查询用户状态信息
 * @param userStateId id
 * @returns 用户状态信息
 */
export function userStateInfo(userStateId: ID) {
  return requestClient.get<UserStateVO>(`${Api.root}/${userStateId}`);
}

/**
 * 用户状态新增
 * @param data 参数
 * @returns void
 */
export function userStateAdd(data: Partial<UserStateVO>) {
  return requestClient.postWithMsg<void>(Api.root, data);
}

/**
 * 用户状态更新
 * @param data 参数
 * @returns void
 */
export function userStateUpdate(data: Partial<UserStateVO>) {
  return requestClient.putWithMsg<void>(Api.root, data);
}

/**
 * 用户状态删除
 * @param userStateIds ids
 * @returns void
 */
export function userStateRemove(userStateIds: IDS) {
  return requestClient.deleteWithMsg<void>(`${Api.root}/${userStateIds}`);
}
